﻿
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace SMSPanasonic.Business
{
    public partial class pa_Customer
    {
    	#region public properties
		public string CustomerPhone { get; set; }
		public string CustomerName { get; set; }
		public string Address { get; set; }
		public bool? Disabled { get; set; }
		public DateTime? CurrentRegisterDate { get; set; }
		#endregion

		#region constructor
		public pa_Customer(){ }

		public pa_Customer(IDataReader rd)
		{
			this.CustomerPhone = rd["CustomerPhone"].ToString();
			this.CustomerName = rd["CustomerName"].ToString();
			this.Address = rd["Address"].ToString();
			this.Disabled = rd["Disabled"].Equals(DBNull.Value) ? (bool?)null : (bool)rd["Disabled"];
			this.CurrentRegisterDate = rd["CurrentRegisterDate"].Equals(DBNull.Value) ? (DateTime?)null : (DateTime)rd["CurrentRegisterDate"];
		}
		#endregion

		#region static method

        public static void InsertOrUpdate(DataTable dtSource)
        {
            SqlParameter param = new SqlParameter("@CustomerPhone", dtSource);
            param.SqlDbType = SqlDbType.Structured;
            param.TypeName = "dbo.CustomerPhoneType";
            SqlHelper.ExecuteNonQuery(AppConfig.ConnectionString, CommandType.StoredProcedure, "usp_pa_Customer_InsertOrUpdate", param);
        }
		#endregion
	}
}
